/*
 *--------------------------------------------------------------------------
 *   File Name:	irq.c
 * 
 * Description:	none
 * 
 * 
 *      Author:	Zhao Yanbai [zhaoyanbai@126.com]
 * 
 *     Version:	1.0
 * Create Date: Thu Jul 16 18:06:22 2009
 * Last Update: Thu Jul 16 18:06:22 2009
 * 
 *--------------------------------------------------------------------------
 */

#include<irq.h>

IRQDesc	irq_desc[NR_IRQS];

int	enable_no_irq_chip(unsigned int irq){return 0;}
int	disable_no_irq_chip(unsigned int irq){return 0;}
IRQChip	no_irq_chip =
{
	.name		= "none",
	.enable		= enable_no_irq_chip,
	.disable	= disable_no_irq_chip
};
IRQDesc	no_irq_desc =
{
	.chip	= &no_irq_chip,
	.action	= NULL,
	.status	= 0,
	.depth	= 0
};
__attribute__ ((regparm(1))) void	irq_handler(pPTRegs regs)
{

	unsigned int irq = regs->irq;
	pIRQDesc	p = irq_desc + irq;
	pIRQAction	action = p->action;
	p->chip->ack(irq);
	while(action)
	{
		action->handler(regs, irq);
		action = action->next;
	}
	p->chip->enable(irq);
}
